<template>
  <div class="com-intro" @click="jump">
    <Nav :navs="navs" cur-page="首页"></Nav>
  </div>
</template>

<script>
  import smoothScroll from 'smoothscroll-polyfill'
  import themeStyleSheet from '../../assets/theme';
  import Nav from '../../components/Nav';

  export default {
    async asyncData(context) {
      // 获取路由中的参数 route 为vueRouter 对象
      // let id = context.route.query.id;

      // ssr阶段获取数据  代理的配置在此处无用
      // let {data} = await context.$axios.get('https://evp.51job.com/51job/api/51microadmin/back.php?action=companyone&id=' + id);

      return {
        // company: data ? data.content.slice(0, 4) : '失败',    // 模板中若引用此数据，则在ssr阶段会渲染到页面中，SEO关键点！
        themeColor1: '#56CCF2',
        themeColor2: '#2F80ED',
        navs: [
          {
            en: 'main',
            zh: '首页',
            modules: [
              {
                en: 'kv',
                zh: '首页',
                data: '{abc: 123}'
              },
            ]
          },
          {
            en: 'about_us',
            zh: '关于我们',
            modules: [
              {
                en: 'Development History',
                zh: '公司简介',
                data: '{abc: 123}'
              },
              {
                en: 'Development History',
                zh: '发展历程',
                data: '{abc: 123}'
              },
              {
                en: 'Product',
                zh: '产品与服务',
                data: '{abc: 123}'
              },
              {
                en: 'Enterprise Honor',
                zh: '企业荣誉',
                data: '{abc: 123}'
              },
              {
                en: 'Employees Story',
                zh: '员工故事',
                data: '{abc: 123}'
              },
            ]
          },
          {
            en: 'benefit',
            zh: '薪资福利',
            modules: [
              {
                en: 'Compensation & Benefits',
                zh: '薪资福利',
                data: '{abc: 123}'
              },
              {
                en: 'Working Environment',
                zh: '工作环境',
                data: '{abc: 123}'
              },
              {
                en: 'Employee Benefit',
                zh: '员工福利',
                data: '{abc: 123}'
              },
            ]
          },
          {
            en: 'process',
            zh: '招聘流程',
            modules: [
              {
                en: 'Recruitment Process',
                zh: '招聘流程',
                data: '{abc: 123}'
              },
              {
                en: 'Campus Roadshows',
                zh: '宣讲行程',
                data: '{abc: 123}'
              },
              {
                en: 'Q & A',
                zh: '常见问题',
                data: '{abc: 123}'
              },
            ]
          },
          {
            en: 'job',
            zh: '招聘职位',
            modules: [
              {
                en: 'Join Us',
                zh: '招聘职位',
                data: '{abc: 123}'
              },
            ]
          },
        ]
      };
    },
    head() {
      return {
        style: [
          {
            cssText: themeStyleSheet({
              themeColor1: this.themeColor1,
              themeColor2: this.themeColor2,
              themeColorKv: '#fff',
              themeColorSelect: this.themeColor1
            }), type: 'text/css'
          }
        ]
      };
    },
    methods: {
      jump() {
        this.$refs.b3.scrollIntoView({behavior: "smooth"});
      }
    },
    components: {
      Nav
    },
    mounted() {
      // 加入polyfill 使 ie 兼容 scrollIntoView(option)
      smoothScroll.polyfill()
    }
  };
</script>

<style lang="scss" scoped>
  .com-intro {
  }
</style>
